<?php

//全局添加jquery库
add_action('API_GLOBAL_JS', function(){
	echo '<script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js"></script>';
}, 0);


//全局添加两个菜单项
add_action('API_GLOBAL_NAV', function(){
	echo '<li class="nav-item"><a href="'.U('index').'">首页</a></li>';
	echo '<li class="nav-item"><a href="'.C('env.bbs').'">论坛</a></li>'; 
}, 0);

//全局添加菜单js
add_action('API_GLOBAL_JS', function(){
echo <<<EOT
<script type="text/javascript">
$(function() {
	$('.nav').append($('<div class="nav-mobile"></div>'));
	$('.nav-item').has('ul').prepend('<span class="nav-click"><i class="nav-arrow"></i></span>');
	$('.nav-mobile').click(function(){
		$('.nav-list').toggle();
	});
	$('.nav-list').on('click', '.nav-click', function(){
		$(this).siblings('.nav-submenu').toggle();
		$(this).children('.nav-arrow').toggleClass('nav-rotate');
	}); 
});
</script>
EOT;
}, 1);

